<?php
use Doctrine\ORM\EntityRepository;

class ArticleRepository
	extends EntityRepository
{
	public function getArticles()
	{
		$dql = 'SELECT a FROM Article a JOIN a.user b WHERE a.user = b.userId ORDER BY b.userId ASC';
		//$dql = 'SELECT a FROM Article a ORDER BY a.createDate DESC';
		$rs = $this->getEntityManager()->createQuery($dql);
		return $rs->getResult();
	}
}